A code generation toot is an efficient, effective way for a developer to automatically render executable program code. The generation tool interprets text in a file and converts the text into executable code that may be recognized and run by an application. Such a tool advantageously saves the developer having to spend significant time and effort coding by hand.
Many such code generation tools exist, though many are problematic. For example, one of the more popular tools uses global variables, of which the developer is required to be aware and keep track when designing the code generation application. The application is therefore by necessity less portable and independent by having to reference global variables. This tool also uses a complicated inflexible syntax in the code generation application, which requires the developer to learn such a syntax.
Another of the more popular tools solves the above problems by providing local variables and less complicated syntax in a code template. The tool uses the template to create a meta-program which then renders the executable code. Code generation is then a two-stage process, i.e., from template to meta-program then from meta-program to executable code, such that the process is more complex than it need be. One example of this complexity occurs in data assignments, where the data associated with the local variables does not pass directly to the executable code from the template, but must first go through the meta-program for intermediate processing before passing to the executable code. Another example of the complexity of this two-stage process is that the template includes a mixture of code to produce the meta-program and code to produce the executable code, which may be confusing. The template is specifically created to generate a meta-program and is therefore not reusable for a different meta-program.
Accordingly, there is a need in the art for an efficient, effective way to render executable program code.